package com.itfanshi.studydemo.controller;

import com.fasterxml.jackson.annotation.JsonAlias;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Map;
import java.util.stream.Collectors;

@RestController
public class FistSpringBootDemo {
    @RequestMapping
    public String hello() {
        ArrayList<String> list = new ArrayList<>();
        list.add("zhangsan,23");
        list.add("lisi,24");
        list.add("wangwu,25");
        Map<String, String> map = list.stream().filter((String s) -> {
            String[] split = s.split(",");
            int age = Integer.parseInt(split[1]);
            return age >= 24;
        }).collect(Collectors.toMap(
                (String s) -> {
                    return s.split(",")[0];
                },
                (String s) -> {
                    return s.split(",")[1];
                }
        ));
        System.out.println(map);
        String s = map.toString();


        return s;
    }
}
